package com.admin.service.impl;

import com.admin.dao.IAdmindao;
import com.admin.dao.impl.AdminDaoImpl;
import com.admin.entity.Admin;
import com.admin.service.IAdminService;
import com.user.entity.BookInfo;
import com.user.entity.School;
import com.user.entity.Users;

import java.util.List;

public class AdminServiceImpl implements IAdminService {


    IAdmindao admindao = null;

    public AdminServiceImpl() {
        admindao = new AdminDaoImpl();
    }

    @Override
    public List<Users> QueryUserList(int pageSize, int currentPage) {
        return admindao.QueryUserList(pageSize, currentPage);
    }

    @Override
    public int getUsersTotalCount() {
        return admindao.getUsersTotalCount();
    }

    @Override
    public boolean adminLogin(Admin admin) {
        return admindao.adminLogin(admin);
    }

    @Override
    public boolean deleteUsers(Users users) {
        return admindao.deleteUsers(users);
    }

    @Override
    public Users getUserAllmsg(int id) {
        return admindao.getUserAllmsg(id);
    }

    @Override
    public boolean IsExistSchoolname(String schoolname) {
        return admindao.IsExistSchoolname(schoolname);
    }

    @Override
    public boolean updateUserInfo(Users users, int id) {
        users.setShoolid(admindao.getSchoolid(users.getSchoolname()));
        System.out.println(users);
        return admindao.updateUserInfo(users, id);
    }

    @Override
    public boolean addBooks(BookInfo bookInfo) {
        return admindao.addBooks(bookInfo);
    }

    @Override
    public BookInfo getBookInfo(int id) {
        return admindao.getBookInfo(id);
    }

    @Override
    public boolean updateBookNumber(int bookid, int number) {
        return admindao.updateBookNumber(bookid, number);
    }

    @Override
    public List<School> getSchoolInfo() {
        return admindao.getSchoolInfo();
    }

    @Override
    public boolean addSchool(String schoolname) {
        return admindao.addSchool(schoolname);
    }

    @Override
    public boolean deleteSchool(int schoolid) {
        return admindao.deleteSchool(schoolid);
    }


}
